package com.sj.parksdk.setting;

import com.sj.parksdk.R;
import com.xuexiang.xutil.common.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class Dictionary {
    private static Dictionary mDictionary;

    public static Dictionary getInstance() {
        if (mDictionary == null) return new Dictionary();
        return mDictionary;
    }

    public static class Car {
        public static class PlateColor {
            public static final String Unknow = "Unknow";
            public static final String White = "White";
            public static final String Black = "Black";
            public static final String Blue = "Blue";
            public static final String Yellow = "Yellow";
            public static final String Green = "Green";

            public static Map<String, Integer> PalteColorMap = new HashMap<>();
            public static Map<String ,String >PlateColorNameMap = new HashMap<>();
        }
        public static class CarType{
            public static final String Small = "Small";
            public static final String Large = "Large";

            public static Map<String,String > CarTypeMap = new HashMap<>();
        }
    }

    public static class Park{
        public static final int Park_Open = 0;
        public static final int Park_Colose = 1;
        public static final int Park_Green = 2;
        public static final int Park_Red = 3;
        public static final int Park_Category_Road = 0;//路侧
        public static final int Park_Category_Park = 1;//停车场

        public static class State{
            public static final int parking = 3;//停车中
            public static final int owe = 4;//欠费
            public static final int finish = 5;//已完成
            public static final int agency = 6;//代扣
            public static final int runaway = 8;//逃费

        }
    }
    public static class QRCode{
        public static final String RECEIVE_COUPONS = "receiveCoupon";//获取优惠券
        public static final String UNLICENSED_ARRIVAL = "unlicensedArrival";//无牌车入场
        public static final String UNLICENSED_DEPARTURE = "unlicensedDeparture";//无牌车扫码出场
        public static final String PREPAYMENT = "prepayment";//场内扫码支付
        public static final String DEPARTURE = "departure";//出场扫码支付

    }

    public void init(){
        //车牌颜色
        Car.PlateColor.PalteColorMap.put(Car.PlateColor.Black, R.color.color_3);
        Car.PlateColor.PalteColorMap.put(Car.PlateColor.White, R.color.color_white);
        Car.PlateColor.PalteColorMap.put(Car.PlateColor.Unknow, R.color.app_color_theme_main);
        Car.PlateColor.PalteColorMap.put(Car.PlateColor.Blue, R.color.app_color_theme_main);
        Car.PlateColor.PalteColorMap.put(Car.PlateColor.Yellow, R.color.color_tip_yellow);
        Car.PlateColor.PalteColorMap.put(Car.PlateColor.Green, R.color.color_tip_green);

        Car.PlateColor.PlateColorNameMap.put(Car.PlateColor.Black, "黑牌车");
        Car.PlateColor.PlateColorNameMap.put(Car.PlateColor.White, "白牌车");
        Car.PlateColor.PlateColorNameMap.put(Car.PlateColor.Unknow, "未知");
        Car.PlateColor.PlateColorNameMap.put(Car.PlateColor.Blue, "蓝牌车");
        Car.PlateColor.PlateColorNameMap.put(Car.PlateColor.Yellow, "黄牌车");
        Car.PlateColor.PlateColorNameMap.put(Car.PlateColor.Green, "新能源车");

        Car.CarType.CarTypeMap.put(Car.CarType.Large,"大型车");
        Car.CarType.CarTypeMap.put(Car.CarType.Small,"小型车");
    }

    public static String getPalteColorWithNumber(String[] numbers){
        if(numbers.length ==0 || numbers.length<7)return Car.PlateColor.Unknow;
        if("WJ".equals(numbers[0]))return   Car.PlateColor.White;
        else if("港澳领使".contains(numbers[6]) || (!StringUtils.isEmpty(numbers[7]) &&  "港澳领使".contains(numbers[7])))return Car.PlateColor.Black;
        else if("学".equals(numbers[6]) || "学".equals(numbers[7]))return Car.PlateColor.Yellow;
        else if("警".equals(numbers[6]) || "警".equals(numbers[7]))return Car.PlateColor.White;
        else return Car.PlateColor.Unknow;
    }

}
